<?php
namespace app\admin\controller;
use think\Controller;

class Base extends Controller
{

    // 登录验证
    protected function _initialize()
    {
        $session_admin_id = session('ADMIN_ID');
        if (empty($session_admin_id)) {
            if ($this->request->isPost()) {
                $this->error("您还没有登录！", url("admin/login/index"));
            } else {
                header("Location:" . url("admin/login/index"));
                exit();
            }
        }

        $this->assign("CONTROLLER_NAME", $this->request->controller());
        $this->assign("ACTION_NAME", $this->request->action());

    }

}